package jvm;

/**
 * @author: cuihao
 * @create: 2020-06-21 01:11
 **/
public class Father {

    public static void main(String[] args) {
        methodA();
    }

    // 锁方法
    public synchronized static void methodA() {
        System.out.println(123);
    }

    // 锁对象
    public void methodB() {
        synchronized (this) {
            System.out.println(234);
        }
    }

    // 锁类
    public void methodC() {
        synchronized (Father.class) {
            System.out.println(345);
        }
    }

}
